//
//  BaseModel.m
//  UI23_基类
//
//  Created by dllo on 15/10/19.
//  Copyright (c) 2015年 蓝鸥科技. All rights reserved.
//

#import "BaseModel.h"

@implementation BaseModel
+ (NSMutableArray *)baseModelArr:(NSArray *)arr{
    NSMutableArray *modelArr = [NSMutableArray array];
    //遍历数组
    for (NSDictionary *dic in arr) {
        //通过便利构造器来创建对象
        @autoreleasepool {
        id model = [[self class] baseModelWithDic:dic];
        
        [modelArr addObject:model];
        }
        
    }
    return modelArr;
}




//遍历构造器
+(instancetype)baseModelWithDic:(NSDictionary *)dic{
    //通过多台创建对象
    id model = [[[[self class] alloc] initWithDic:dic] autorelease];
    return model;
}

- (instancetype)initWithDic:(NSDictionary *)dic{
    self = [super init];
    if (self) {
        //进行KVC的复制
        [self setValuesForKeysWithDictionary:dic];
    }
    return self;
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key{
    
}
@end
